#pragma  once
#include "scene.h"

//class Sensor;
class SceneView;

class Title : public QGraphicsTextItem{
	Q_OBJECT
public:
	Title(SceneView* _scene, QGraphicsObject* _source, const QPointF &_position_relative_source, const bool &visible, const QString &_text = "", const QString &_type = "");
	void adjust(const QPointF &_pos);
	void setText(QString _text){ text = _text; setPlainText(text); }
	QString getText(){ return text; }
	void setPosition(const QPointF &_pos);
protected:
	void mousePressEvent(QGraphicsSceneMouseEvent *event);
	void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
	void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event);
	void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
private:
	QString text;
	SceneView* scene;
	QGraphicsObject* source;
	QPointF position_relative_source;
	QString getDefaultName(const QString &_type);
};
